﻿using System;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
using System.ServiceModel;
using System.Diagnostics;
using System.Collections.Generic;

namespace Kaesoft.Hospedaje.Proxy
{
    public class Inspector : IClientMessageInspector
    {
        #region IClientMessageInspector Members

        public void AfterReceiveReply(ref Message reply,
                                        object correlationState)
        {
            Debug.WriteLine("SOAP Response: {0}", reply.ToString());
        }

        public object BeforeSendRequest(ref Message request,
                                        IClientChannel channel)
        {
            MessageHeader header;
            const string STR_Customer_Unique_Id = "Edwin";
            header = MessageHeader.CreateHeader("Identity",
                                                    "http://www.adilmughal.com",
                                                    STR_Customer_Unique_Id);
            request.Headers.Add(header);
            Debug.WriteLine("SOAP Request: {0}", request.ToString());
            return null;
        }
        #endregion
    }
}
